import React from 'react';
import {Form, Row, Col, Button, DatePicker, message ,Radio,Input} from 'antd';
import { withRouter } from 'react-router-dom'
import {injectIntl} from 'react-intl';
import axios from 'axios';
import moment from 'moment';


const FormItem = Form.Item;
const createForm = Form.create;
const RadioGroup = Radio.Group;

@withRouter
class AddCompany extends React.Component {
    constructor(props) {
        super(props);
        this.common = this.props.intl.messages.common;
        this.state = {
            selectTime: moment().format('YYYY.MM.DD 23:59:59'),
            summary: [],
            visible: false,
            refresh:0
        }
    }

    handleSubmit = (e) => {
        e.preventDefault();
        this.props.form.validateFieldsAndScroll((errors, values) => {
            if (!!errors) {
                console.log('Errors in form!!!');
                return;
            }
            console.log(values);
            this.props.history.push('/AddComDetails')
        });
    }

    render() {
        const formItemLayout = {
            labelCol: {
              xxl: { span: 8 },
              xl: { span: 7 },
            },
            wrapperCol: {
              xxl: { span: 16 },
              xl: { span: 10 },
            },
          };
          const tailFormItemLayout = {
            wrapperCol: {
              xl: {
                span: 10,
                offset: 7,
              }
            },
          };
        const {getFieldDecorator} = this.props.form;
        return (
            <div>
                <form form={this.props.form}>
                    <FormItem
                    {...formItemLayout}
                    label={"负责人账号"}
                    >
                        {getFieldDecorator('account')(
                            <Input/>
                        )}
                    </FormItem>
                    <FormItem
                     {...formItemLayout}
                     label={"身份证号"}
                    >
                        {getFieldDecorator('idNo')(
                            <Input/>
                        )}
                    </FormItem>
                    <FormItem
                    {...formItemLayout}
                    label="账号归属"
                    >
                    {getFieldDecorator('radio-group')(
                        <RadioGroup>
                        <Radio value="0">企业</Radio>
                        <Radio value="1">个人</Radio>
                        </RadioGroup>
                    )}
                    </FormItem>
                    <FormItem
                     {...formItemLayout}
                     label={"组织机构代码"}
                    >
                        {getFieldDecorator('orgCode')(
                            <Input />
                        )}
                    </FormItem>
                    <FormItem
                    {...tailFormItemLayout}
                    >
                        <Button className={"ant-btn-84"} type={'primary'} onClick={this.handleSubmit}>下一步</Button>
                    </FormItem>
                </form>
            </div>
        )
    }
}

AddCompany = createForm()(AddCompany);
export default injectIntl(AddCompany)
